#include<iostream>
using namespace std;
void move(char x,char z);
void hanoi(int n,char x,char y,char z);
int main()
{
    int num;
    cout<<"请输入盘子数：";
    cin>>num;
    cout<<"按\"汉诺塔\"规则，把"<<num
    <<"个盘子从A柱搬到C柱的步骤是:"<<endl;
    hanoi(num,'A','B','C');
    return 1;
}
void move(char x,char z)
{
    static int i;
    i++;
    cout<<i<<":"<<x<<"->"<<z<<endl;
}
void hanoi(int n,char x,char y,char z)
{
    if (1==n)
    {
        move(x,z);
    }
    else
    {
        hanoi(n-1,x,z,y);
        move(x,z);
        hanoi(n-1,y,x,z);
    }
}